package com.jeomo.mem.starter.service;

import com.jeomo.mem.starter.dto.MemberDiscountRuleDto;
import com.jeomo.mem.starter.dto.MemberRuleDto;
import com.jeomo.mem.starter.entity.MemberDiscountRule;
import com.jeomo.mem.starter.entity.MemberDiscountRuleList;

import java.util.List;

/**
 * 会员折扣服务
 * @author:Jackpot
 * @create 2020-09-24 14:59
 * @description:
 */
public interface IMemberDiscountService{


    /**
     * 保存规则 :新增/修改
     * @param memberRule
     * @param memberRuleListList
     */
    int saveRule(MemberDiscountRule memberRule, List<MemberDiscountRuleList> memberRuleListList);

    int saveRule(MemberDiscountRule memberRule, List<MemberDiscountRuleList> memberRuleListList, boolean addOrUpdate);

    /**
     * 新增规则明细
     * @param memberRule
     * @param memberRuleList
     * @return
     */
    int insertRuleDetail(MemberDiscountRule memberRule,List<MemberDiscountRuleList> memberRuleList);


    /**
     * 删除规则
     * @param ruleCode
     * @return
     */
    int deleteRule(String ruleCode);

    /**
     * 删除规则执行单
     * @param ruleCode 规则明细ID
     * @return
     */
    int deleteRuleExe(String ruleCode);


    /**
     * 删除折扣规则明细
     * @param ruleCode 规则ID
     * @return
     */
    int deleteRuleDetail(String ruleCode);

    /**
     * 获取一条会员折扣规则的详情信息
     * @param ruleCode
     * @return
     */
    MemberDiscountRuleDto getMemberRuleById(String ruleCode);

    /**
     * 获取所有折扣规则
     * @return
     */
    List<MemberDiscountRule> getAllRules();


    /**
     * 计算折扣
     *
     * @param levelCode 会员等级
     * @param goodsCode 消费的商品编码
     * @return
     */
    Double getDiscount(String levelCode, String goodsCode);

}
